#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
char arr[100] = { 0 };

int my_strlen(char* arr)
{
	int i = 0;
	while (arr[i] != '\0')i++;
	return i;
}

int main()
{
	int k = 0, l;
	int rec = 0;
	scanf("%s", arr);
	scanf("%d", &k);
	l = my_strlen(arr);
	rec = (rec + k) % l;
	for (int i = rec, j = 0; j < l; j++) {
		printf("%c",arr[rec]);
		rec++;
		rec %= l;
	}
	return 0;
}